package com.zr.myorder.controller;


import com.zr.myorder.pojo.PaymentInformationUpdateVo;
import com.zr.myorder.service.MyOrderService;
import com.zr.util.ResultBuildVo;
import com.zr.util.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * 我的订单修改页面
 *
 * Created by Administrator on 2019/7/3 0003.
 */
@RestController
public class MyOrderController {
    @Autowired
    private MyOrderService myOrderService;


    /**
     * 修改分期缴费
     * @param
     * @param bindingResult
     * @return
     */
    @PostMapping("updatePaymentInformation")
    public ResultVo updatePaymentInformation(@RequestBody @Valid PaymentInformationUpdateVo paymentInformationUpdateVo, BindingResult bindingResult,HttpServletRequest request){

        if (bindingResult.hasErrors()){
            return ResultBuildVo.error(bindingResult.getFieldError().getDefaultMessage(),"500");
        }
        return myOrderService.updatePaymentInformation(paymentInformationUpdateVo,request);
    }


}
